package com.matrix.java.chap_05.exercise;

public class EX5_16 {
    public static void main(String[] args) {
        int sum1 = 0;
        int sum2 = 0;
        int i2 = 1;
        for (int i = 0; i < 143; i++) {
            if (sum1 < 10000) {
                sum1 += i;
            } else {
                System.out.println(sum1);
            }
        }
        while (sum2 < 10000) {
            sum2 += i2;
            i2++;
        }
        System.out.println(sum2);
    }
}
